import React from 'react';
import { getAntd,getEcCom,getLabel } from '../../util/convert';

export default class WeaSapBrowser extends React.Component{
    constructor(){
        super();
    }
    doBrowserChange = (_ids, _names, _datas) => {
        const { dataParams,onChange } = this.props;
        const { requestid,fielddbtype } = dataParams;
        let params = {fromNodeorReport:"0",requestid,fielddbtype};
        params["datas"] = JSON.stringify(_datas);
        //此接口由SAP模块提供，将浏览按钮选中数据转换为流程识别的数据
        const { WeaTools } = getEcCom();
        WeaTools.callApi('/api/SapIntegration/browser/assignToBill', 'POST', params).then(result =>{
            onChange && onChange(result.datas);
        });
    }
    render(){
        const { WeaBrowser } = getEcCom();
        const { dataParams } = this.props;
        console.log(mobx.toJS(dataParams));
        return (
            <WeaBrowser ecId={`${this && this.props && this.props.ecId || ''}_WeaBrowser@szz87v`}
                type="227"
                title={getLabel(30313,"系统集成多选浏览按钮")}
                isSingle={false}
                isMultCheckbox={true}
                hasAdvanceSerach={true}
                sap={true}
                customized
                dataParams={dataParams}
                completeParams={dataParams}
                conditionDataParams={dataParams}
                searchParams={{issearch:true}}
                onChange={this.doBrowserChange}
                displaySearchAdInBar={dataParams.displaySearchAdInBar}
            >
                <i className="icon-workflow-form-sap detailBtn" title="SAP" />
            </WeaBrowser>
        )
    }
}
